version 15.1
*The survey asked some respondents to rate the ideology of two interest groups (randomly chosen from 45)
*it asked others to say whether they had heard of two randomly chosen groups from 45


insheet using "../../data/raw/2017Survey_data_pii_removed.csv", clear


destring q30 q32 q34 q36 q38 q42  interest_knowledg* field_1ik field_2ik libcon  hhi - hispanic,ignore("NA") replace
 
*pk
tab1 q30 q32 q34 q36 q38 q42 
recode q30 4=1 -99 1/3 5=0, g(pk1)
recode q32 2=1 -99 1 3/5=0, g(pk2)
recode q34 3=1 -99 1 2 4 5=0, g(pk3)
recode q36 3=1 -99 1 2 4 5=0, g(pk4)
recode q38 1=1 -99 2/5=0, g(pk5)
recode q42 1=1 -99 2/5=0, g(pk6)
sum pk*
corr pk*
pwcorr pk*,obs
egen count=rownonmiss( pk*)
tab count  // initially, respondents answered six questions, but the survey was long so we cut it to four randomly chosen ones
egen pk=rmean( pk*)
tab1 hhi - hispanic libcon


keep  interest_knowledg* field_1ik field_2ik libcon pk hhi - hispanic


// names of the two groups people were asked about
rename field_1ik group1
rename field_2ik group2

// drop individuals who were not assigned to these questions
// people who skip questions were assigned to -99 not missing
tab1 interest_knowledg*,
tab1 interest_knowledg*,mis
drop if interest_knowledg1==. & interest_knowledg2 == .
drop if libcon == -99 // drop people who did not answer libcon question
drop if libcon == .

count // how many respondents
g responseid=_n
reshape long interest_knowledg group, i(responseid) j(question) // reshape to facilitate merging

g interest_knowledgwdk=interest_knowledg 
recode interest_knowledg (-99=.) (8=.) // recode DK seen but not answered to missing

// recode so that higher values are more conservative, as CF scores are coded
replace interest_knowledg = 8 - interest_knowledg
replace libcon = 8 - libcon 

merge m:1 group using ../../data/raw/cfscores, nogen keep(3) // merge in CF scores from Adam Bonica's data set
drop cfname
drop contributor_cfscore recipient_cfscore_dyn bonica_cid

// create three point scales
recode interest_knowledg (1/3=-1) (4=0) (5/7=1), g(interest_knowledg3)
recode libcon (1/3=-1) (4=0) (5/7=1), g(libcon3)
recode recipient_cfscore (-5/-.5=-1) (-.5/.5=0) (.5/5=1), g(recipient_cfscore3)


/*
This coding treats six pacs as moderate, blue dog and five bipartisan Israeli pacs:

The Tuesday Group is an informal caucus of approximately 50 moderate Republican members of the United States House of Representatives.

The Heartland PAC is a pro-Israel political action committee that makes campaign contributions to both Democratic and Republican.

NACPAC is the nation’s largest pro-Israel political action committee.

The Desert Caucus is a Jewish bi-partisan political action committee (PAC) whose mission is to promote and strengthen the relationship between the United States and Israel.  We are one of the oldest PAC's in the country.

Over thirty years later, the Washington PAC has grown to become the second largest pro-Israel PAC in terms of contributions to candidates.  Overall, over three million dollars has been carefully distributed on a bipartisan basis to Senators, Representatives, and candidates who share the view that a secure Israel is in the best interests of the United States.
*/
preserve
collapse recipient_cfscore3, by(group)
list group if recipient_cfscore3 == 0
restore

save ../../data/cleaned/study1_individual, replace

// collapse up to group level
collapse interest_knowledg, by(group short recipient_cfscore3 recipient_cfscore)
isid group
isid short
save ../../data/cleaned/study1between_aggregated, replace
